#!/bin/bash
echo "1.初始化操作系统环境"
sudo apt-get remove docker docker-engine docker.io containerd runc

sudo apt-get update

sudo apt-get install -y \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common

curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -

sudo add-apt-repository \
     "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu \
     $(lsb_release -cs) \
     stable"

 sudo apt-get update   

echo "2.安装docker-ce"
 sudo apt-get install docker-ce=5:19.03.9~3-0~ubuntu-xenial docker-ce-cli=5:19.03.9~3-0~ubuntu-xenial containerd.io
systemctl start docker
systemctl enable docker
docker version


echo "3.安装docker-compose"
curl -L https://get.daocloud.io/docker/compose/releases/download/v2.3.3/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose -v
echo "4.配置docker 镜像加速"

cat > /etc/docker/daemon.json << EOF
{
	 "registry-mirrors": [ "https://03qe6qjc.mirror.aliyuncs.com", "https://registry.docker-cn.com" ]
	  ,"data-root": "/data/docker"
}
EOF

systemctl daemon-reload
systemctl restart docker
docker info

echo "5.安装辅助工具"
sudo apt-get  install -y lrzsz unzip zip 


echo "6.创建应用发布目录"
mkdir -pv /data/{mysql,redis,www,dfiles,tools}


echo "7. 安装nginx "
docker run -itd -v /data/www/nginxWebUI:/home/nginxWebUI -e BOOT_OPTIONS="--server.port=7000" --privileged=true --net=host cym1102/nginxwebui:latest

echo "8. 安装redis sentinel"


echo "9. 安装mongodb 副本集"


echo "10. 安装mysql"


echo "11. 初始化数据库"







